﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using TX_TOOLBOX;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;

namespace TX_Demo
{

    ///=============================================================================================
    /// 说明标注
    /// 
    /// 
    /// 
    ///=============================================================================================
    public class Step08_Tendon : BaseBlock
    {

        public override void Draw(DatabaseToAcad block)
        {

            Point3d structPt1 = new Point3d(0, -5000, 0);

            Vector3d vect = new Vector3d(3, 9, 0);      ///
            Vector3d vectUnit = vect.GetNormal();       ///取单位向量
            Vector3d vectPer = vectUnit.RotateBy(Math.PI * 0.5, Vector3d.ZAxis);  ///向量的垂直，顺时针方向转90度


            Point3d structPt2 = structPt1 + vectUnit.MultiplyBy(2000);      ///点可以是点和向量相加
            Point3d structPt3 = structPt1 + vectPer.MultiplyBy(2000);




            // ======================== 标注 ====================================
            //block.AddDimContinueAlign_AutoAdjust( ,);/// 自动向外调整位置
            //block.AddDimension_UserTextPoint()///  一般情况下文字位置自定处理的，但是也可以设定




            // ======================== 绘制钢筋 ====================================

            /// ------ 绘制点钢筋 ---------
            double BHC = 30;
            ISteelBar ist_dot = new ISteelBar("1", 12, SteelBarType.HRB400, "水平钢筋", 101);
            SteelDotByLine st_dot = SteelFactory.CreateSteelDots(ist_dot, structPt1, structPt2, BHC);
            block.AddSteelEntity(st_dot);


            /// ------ 绘制线钢筋 ---------
            ISteelBar ist_line = new ISteelBar("1", 12, SteelBarType.HRB400, "水平钢筋", 101);
            SteelLines st_line = SteelFactory.CreateSteelParalLine(ist_line, structPt1, structPt3, BHC, 45, 2000);
            block.AddSteelEntity(st_line);
        }

        [CommandMethod("tx_step10")]
        public static void TestDrawCommond()
        {

            Step08_Tendon bk1 = new Step08_Tendon();
            bk1.DimScale = 50;  ///设定图块比例

            PaperLayout paper = new PaperLayout(50);///设定图纸比例
            paper.AddBlock(bk1);
            paper.AutoLayoutBlock_OneColumn(true);


            ExportToCAD.ExportToAutoCAD_NotUserInteraction(paper);
        }

    }



}
